/*
 * @Descripttion:
 * @version:
 * @Author: xcb
 * @Date: 2021-03-16 09:18:22
 * @LastEditors: yangyongtao
 * @LastEditTime: 2024-04-24 10:07:34
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import cesium from "vite-plugin-cesium";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
const { resolve } = require("path");

// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
  },
  server: {
    proxy: {
      // 选项写法
      "/model": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\model/, ""),
      },
      "/real": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/swns": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/yangTzeModel": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/yangtzeRiverModel": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/water": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/sedModel": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/rainInfo": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
      "/singleWaterInfo": {
        target: "http://10.6.13.222:8083",
        // target: "http://10.6.13.245:8012",
        changeOrigin: true,
        ws: true,
        // rewrite: (path) => path.replace(/^\real/, ""),
      },
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
  plugins: [
    vue(),
    Components({
      resolvers: [AntDesignVueResolver()],
    }),
    cesium(),
  ],
});
